package com.wcar.store.controller;

import com.wcar.common.entity.CarWashRecord;
import com.wcar.common.entity.Store;
import com.wcar.common.entity.StoreEvaluate;
import com.wcar.common.vo.Result;
import com.wcar.store.service.impl.CarWashRecordServiceImpl;
import com.wcar.store.service.impl.StoreServiceImpl;
import com.wcar.store.vo.CalendarVo;
import com.wcar.store.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: four-wcar-idea
 * @description:
 * @author: 张云龙
 * @create: 2024-05-31 17:10
 **/
@RestController
@RequestMapping("store")
public class StoresController {

	@Autowired
	private StoreServiceImpl storeService ;
	@Autowired
	private CarWashRecordServiceImpl carWashRecordService;

	@PostMapping("/api/searchStore")
	public Result<List<Store>>  apisearchStore(@RequestBody UserVo userVo){
		return storeService.apisearchStore(userVo);
	}
	@PostMapping("/api/selectByStoreId")
	public Result<Store>  selectByStoreId(String storeId){
		return storeService.selectByStoreId(storeId);
	}
	//查询绑定的门店数
	@PostMapping("/api/selectStoreBind")
	public Result<List<Store>> selectNumByUserId(Integer userId){
        return storeService.selectNumByUserId(userId);
    }
	//查询服务次数
	@GetMapping("/api/selectNumByUserId")
	public Result<List<CarWashRecord>> selectCarNumByUserId(Integer userId){
		return carWashRecordService.selectCarNumByUserId(userId);
	}
	//查询洗车记录
	@PostMapping("/washrecord/api/selectRecordByUserId")
	public Result<List<CalendarVo>> selectRecordByUserId(Integer userId,String createDate){
		System.out.println(createDate+"++++++++++++================================================================================");
        return carWashRecordService.selectRecordByUserId(userId,createDate);
    }
}
